;/////////////////////////////////////////////////////////////;
;                                                             ;
;                    SimpleDX11 Structures                    ;
;                                                             ;
;                                                             ;
;                   (c) 2012 SimpleDX Team                    ;
;                                                             ;
;                         License: MIT                        ;
;                                                             ;
;/////////////////////////////////////////////////////////////;


Macro AddPadding(_padding)
  CompilerIf #PB_Compiler_Processor=#PB_Processor_x64 : _padding : CompilerEndIf
EndMacro

;- DXGI_RATIONAL ; 32Bit 8 Byte, 64Bit 8 Byte
Structure DXGI_RATIONAL
  Numerator.l
  Denominator.l
EndStructure

;- DXGI_MODE_DESC ; 32Bit 28 Byte, 64Bit 28 Byte
Structure DXGI_MODE_DESC
  Width.l
  Height.l
  RefreshRate.DXGI_RATIONAL
  Format.l                      ;DXGI_FORMAT Konstante ; 32Bit 4 Byte, 64Bit 4 Byte
  ScanlineOrdering.l            ;DXGI_MODE_SCANLINE_ORDER Konstante ; 32Bit 4 Byte, 64Bit 4 Byte
  Scaling.l                     ;DXGI_MODE_SCALING ; 32Bit 4 Byte, 64Bit 4 Byte
EndStructure

;- DXGI_SAMPLE_DESC ; 32Bit 8 Byte, 64Bit 8 Byte
Structure DXGI_SAMPLE_DESC
  Count.l
  Quality.l
EndStructure

;- DXGI_SWAP_CHAIN_DESC
Structure DXGI_SWAP_CHAIN_DESC ; 32Bit 60 Byte, 64Bit 72 Byte
  BufferDesc.DXGI_MODE_DESC
  SampleDesc.DXGI_SAMPLE_DESC
  BufferUsage.l                   ; DXGI_USAGE Konstante ; 32Bit 4 Byte, 64Bit 4 Byte
  BufferCount.i
  OutputWindow.i
  Windowed.l
  SwapEffect.l                     ;DXGI_SWAP_EFFECT ; 32Bit 4 Byte, 64Bit 4 Byte
  Flags.i 
EndStructure

;- D3D11_VIEWPORT
Structure D3D11_VIEWPORT; 32Bit 24 Byte, 64Bit 24 Byte
  TopLeftX.f
  TopLeftY.f
  Width.f
  Height.f
  MinDepth.f
  MaxDepth.f 
EndStructure

;- D3D11_COUNTER_DESC
Structure D3D11_COUNTER_DESC  ; 32Bit 8 Byte, 64Bit 8 Byte
  Counter.l                       ;
  MiscFlags.l
EndStructure

;- D3D11_COUNTER_INFO
Structure D3D11_COUNTER_INFO  ; 32Bit 12 Byte, 64Bit 12 Byte
  LastDeviceDependentCounter.l      ; D3D11_COUNTER Konstante
  NumSimultaneousCounters.l
  NumDetectableParallelUnits.b 
  AddPadding(_pad1.b)
  AddPadding(_pad2.w)
EndStructure

;- D3D11_RENDER_TARGET_BLEND_DESC
Structure D3D11_RENDER_TARGET_BLEND_DESC ; 32Bit 32 Byte, 64Bit 32 Byte
  BlendEnable.l
  SrcBlend.l
  DestBlend.l
  BlendOp.l
  SrcBlendAlpha.l
  DestBlendAlpha.l
  BlendOpAlpha.l
  RenderTargetWriteMask.b
  AddPadding(_pad3.b)
  AddPadding(_pad4.w)
EndStructure

;- D3D11_BLEND_DESC
Structure D3D11_BLEND_DESC ; 32Bit 264 Byte, 64Bit  264 Byte
  AlphaToCoverageEnable.l
  IndependentBlendEnable.l
  RenderTarget.D3D11_RENDER_TARGET_BLEND_DESC[8]
EndStructure

;- D3DXCOLOR
Structure D3DXCOLOR
  r.f
  g.f
  b.f
  a.f
EndStructure

;- XMFLOAT2
Structure XMFLOAT2
  x.f
  y.f
EndStructure

;- XMFLOAT3
Structure XMFLOAT3
  x.f
  y.f
  z.f
EndStructure

;- XMFLOAT4
Structure XMFLOAT4
  x.f
  y.f
  z.f
  w.f
EndStructure


;- VERTEX
Structure VERTEX
  Vertex.XMFLOAT4
EndStructure
  
;- Vertex with Color
Structure VC_VERTEX
  Vertex.XMFLOAT4
  Color.D3DXCOLOR
EndStructure  

;- Vertex with Texture
Structure VT_VERTEX
  Vertex.XMFLOAT4
  Texture.XMFLOAT2
EndStructure 
  
;- Vertex with Normals
Structure VN_VERTEX
  Vertex.XMFLOAT4
  Normal.XMFLOAT3
EndStructure   
  
;- Vertex with Texture & Normals
Structure VTN_VERTEX
  Vertex.XMFLOAT4
  Texture.XMFLOAT2  
  Normal.XMFLOAT3
EndStructure  

;- Vertex with Color & Texture
Structure VCT_VERTEX
  Vertex.XMFLOAT4
  Color.D3DXCOLOR
  Texture.XMFLOAT2
EndStructure  

;- Vertex with Normals, Color & Texture 
Structure VNCT_VERTEX
  Vertex.XMFLOAT4
  Normals.XMFLOAT3
  Color.D3DXCOLOR
  Texture.XMFLOAT2
EndStructure   


;- D3D11_INPUT_ELEMENT_DESC
Structure D3D11_INPUT_ELEMENT_DESC ; 32Bit 28 Byte, 64Bit 32 Byte
  *SemanticName
  SemanticIndex.l
  Format.l                                        ;DXGI_FORMAT Konstante
  InputSlot.l
  AlignedByteOffset.l
  InputSlotClass.l                                ;D3D11_INPUT_CLASSIFICATION Konstante
  InstanceDataStepRate.l
EndStructure

;- D3D11_BUFFER_DESC
Structure D3D11_BUFFER_DESC ; 32Bit 24 Byte, 64Bit 24 Byte
  ByteWidth.l
  Usage.l                                        ; D3D11_USAGE Konstante
  BindFlags.l
  CPUAccessFlags.l
  MiscFlags.l
  StructureByteStride.l
EndStructure

;- D3D11_SUBRESOURCE_DATA
Structure D3D11_SUBRESOURCE_DATA ; 32Bit 12 Byte, 64Bit 16 Byte
  *pSysMem
  SysMemPitch.l
  SysMemSlicePitch.l
EndStructure

;- D3D11_MAPPED_SUBRESOURCE
Structure D3D11_MAPPED_SUBRESOURCE ; 32Bit 12 Byte, 64Bit 16 Byte
  *pData
  RowPitch.l
  DepthPitch.l
EndStructure




;- D3DMATRIX
Structure D3DMATRIX  
  _11.f : _12.f : _13.f : _14.f
  _21.f : _22.f : _23.f : _24.f
  _31.f : _32.f : _33.f : _34.f
  _41.f : _42.f : _43.f : _44.f
EndStructure

;- D3DMATRIX2
Structure D3DMATRIX2
  _1.D3DMATRIX
  _2.D3DMATRIX
EndStructure

;- D3DMATRIX3
Structure D3DMATRIX3
  _1.D3DMATRIX
  _2.D3DMATRIX
  _3.D3DMATRIX
EndStructure

;- D3D11_TEXTURE2D_DESC
Structure D3D11_TEXTURE2D_DESC 
  Width.l
  Height.l
  MipLevels.l
  ArraySize.l
  Format.l
  SampleDesc.DXGI_SAMPLE_DESC
  Usage.l
  BindFlags.l
  CPUAccessFlags.l
  MiscFlags.l
EndStructure

Structure D3D11_DEPTH_STENCILOP_DESC 
  StencilFailOp.l
  StencilDepthFailOp.l
  StencilPassOp.l
  StencilFunc.l
EndStructure

;- D3D11_DEPTH_STENCIL_DESC
Structure D3D11_DEPTH_STENCIL_DESC ; 32Bit 52 Byte, 64Bit  52 Byte
  DepthEnable.l
  DepthWriteMask.l
  DepthFunc.l
  StencilEnable.l
  StencilReadMask.b
  StencilWriteMask.b
  padding_1.w                           ; padding
  FrontFace.D3D11_DEPTH_STENCILOP_DESC
  BackFace.D3D11_DEPTH_STENCILOP_DESC
EndStructure

;- D3D11_TEX1D_DSV
Structure D3D11_TEX1D_DSV 
  MipSlice.l
EndStructure

;- D3D11_TEX1D_ARRAY_DSV
Structure D3D11_TEX1D_ARRAY_DSV 
  MipSlice.l
  FirstArraySlice.l
  ArraySize.l
EndStructure

;- D3D11_TEX2D_DSV
Structure D3D11_TEX2D_DSV 
  MipSlice.l
EndStructure

;- D3D11_TEX2D_ARRAY_DSV
Structure D3D11_TEX2D_ARRAY_DSV 
  MipSlice.l
  FirstArraySlice.l
  ArraySize.l
EndStructure

;- D3D11_TEX2DMS_DSV
Structure D3D11_TEX2DMS_DSV 
  UnusedField_NothingToDefine.l
EndStructure

;- D3D11_TEX2DMS_ARRAY_DSV
Structure D3D11_TEX2DMS_ARRAY_DSV 
  FirstArraySlice.l
  ArraySize.l
EndStructure

;- D3D11_DEPTH_STENCIL_VIEW_DESC
Structure D3D11_DEPTH_STENCIL_VIEW_DESC 
  Format.l
  ViewDimension.l
  Flags.l
  StructureUnion
    Texture1D.D3D11_TEX1D_DSV
    Texture1DArray.D3D11_TEX1D_ARRAY_DSV
    Texture2D.D3D11_TEX2D_DSV
    Texture2DArray.D3D11_TEX2D_ARRAY_DSV
    Texture2DMS.D3D11_TEX2DMS_DSV
    Texture2DMSArray.D3D11_TEX2DMS_ARRAY_DSV
  EndStructureUnion
EndStructure
  

;- D3D11_RASTERIZER_DESC
Structure D3D11_RASTERIZER_DESC 
  FillMode.l
  CullMode.l
  FrontCounterClockwise.l
  DepthBias.l
  DepthBiasClamp.f
  SlopeScaledDepthBias.f
  DepthClipEnable.l
  ScissorEnable.l
  MultisampleEnable.l
  AntialiasedLineEnable.l
EndStructure

;- D3D11_SHADER_DESC
Structure D3D11_SHADER_DESC 
  Version.l
  AddPadding(_pad1.l)
  *Creator
  Flags.l
  ConstantBuffers.l
  BoundResources.l
  InputParameters.l
  OutputParameters.l
  InstructionCount.l
  TempRegisterCount.l
  TempArrayCount.l
  DefCount.l
  DclCount.l
  TextureNormalInstructions.l
  TextureLoadInstructions.l
  TextureCompInstructions.l
  TextureBiasInstructions.l
  TextureGradientInstructions.l
  FloatInstructionCount.l
  IntInstructionCount.l
  UintInstructionCount.l
  StaticFlowControlCount.l
  DynamicFlowControlCount.l
  MacroInstructionCount.l
  ArrayInstructionCount.l
  CutInstructionCount.l
  EmitInstructionCount.l
  GSOutputTopology.l
  GSMaxOutputVertexCount.l
  InputPrimitive.l
  PatchConstantParameters.l
  cGSInstanceCount.l
  cControlPoints.l
  HSOutputPrimitive.l
  HSPartitioning.l
  TessellatorDomain.l
  cBarrierInstructions.l
  cInterlockedInstructions.l
  cTextureStoreInstructions.l
EndStructure

;- D3D11_SIGNATURE_PARAMETER_DESC
Structure D3D11_SIGNATURE_PARAMETER_DESC 
  *SemanticName
  SemanticIndex.l
  Register.l
  SystemValueType.l
  ComponentType.l  
  Mask.b  
  ReadWriteMask.b
  padding_1.w                    ; padding
  Stream.l
  MinPrecision.l
EndStructure

;- D3D11_SHADER_BUFFER_DESC
Structure D3D11_SHADER_BUFFER_DESC 
  *Name
  Type.l
  Variables.l
  Size.l
  uFlags.l
EndStructure

;-D3DX11_IMAGE_INFO
Structure D3DX11_IMAGE_INFO 
  Width.l
  Height.l
  Depth.l
  ArraySize.l
  MipLevels.l
  MiscFlags.l
  Format.l
  ResourceDimension.l
  ImageFileFormat.l
EndStructure

;- D3DX11_IMAGE_LOAD_INFO
Structure D3DX11_IMAGE_LOAD_INFO 
  Width.l
  Height.l
  Depth.l
  FirstMipLevel.l
  MipLevels.l
  Usage.l
  BindFlags.l
  CpuAccessFlags.l
  MiscFlags.l
  Format.l
  Filter.l
  MipFilter.l
  *pSrcInfo.D3DX11_IMAGE_INFO
EndStructure

;- D3D11_SAMPLER_DESC
Structure D3D11_SAMPLER_DESC 
  Filter.l
  AddressU.l
  AddressV.l
  AddressW.l
  MipLODBias.f
  MaxAnisotropy.l
  ComparisonFunc.l
  BorderColor.f[4]
  MinLOD.f
  MaxLOD.f
EndStructure

;- D3D11_SHADER_INPUT_BIND_DESC
Structure D3D11_SHADER_INPUT_BIND_DESC 
  *Name
  Type.l
  BindPoint.l
  BindCount.l
  uFlags.l
  ReturnType.l
  Dimension.l
  NumSamples.l
EndStructure



;- DXGI_ADAPTER_DESC 
Structure DXGI_ADAPTER_DESC1
  Description.w[128]
  VendorId.l
  DeviceId.l
  SubSysId.l
  Revision.l
  *DedicatedVideoMemory
  *DedicatedSystemMemory
  *SharedSystemMemory
  AdapterLuid.LUID
  Flags.l
EndStructure

Structure D2D1_PIXEL_FORMAT 
   format.l
   alphaMode.l
EndStructure


; IDE Options = PureBasic 5.20 beta 14 LTS (Windows - x64)
; CursorPosition = 216
; FirstLine = 195
; Folding = -
; EnableXP
; EnableCompileCount = 1
; EnableBuildCount = 0